package com.netease.spring.ch1.knight;

import com.netease.spring.exceptions.QuestException;

public class KnightOfTheRoundTable implements Knight {
    private String name;

    private Quest quest;

    public KnightOfTheRoundTable(String name) {
        System.out.println("init knight with name = " + name);
        this.name = name;
    }

    public KnightOfTheRoundTable(Quest quest) {
        this.quest = quest;
    }

    public void setQuest(Quest quest) {
        this.quest = quest;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public Object embarkQuest() throws QuestException {
        // TODO Auto-generated method stub
        System.out.println("KnightOfTheRoundTable's name is " + name);
        return quest.embark();
    }

}
